//加油加油

/*
#include<iostream>
using namespace std;
#include<vector>
//#include<string>
const int N = 1e5 + 10;
int a[N];
int m;
string s;
int n;
int flag = 0;

int main() {
	cin >> m;
	while (m--) {
		cin >> s;
		if (s == "push") {
			cin >> n;
			a[flag++] = n;
		}
		if (s == "pop") {
			if(flag != 0)
				a[--flag]=0;			
		}
		if (s == "empty") {
			if (flag == 0)
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		}
		if (s == "query") {	
			if (flag != 0)
				cout << a[flag-1] << endl;
			else
				cout << "empty" << endl;
		}
	}


	return 0;
}

*/

/*

// 十进制转换为任意进制

#include<iostream>
using namespace std;

int calc(char c) {

	if (c >= 'A')
		return 10 + c - 'A';
	return c - '0';
}

int change(int k, string s) {

	int ans = 0;
	for (int i = 0; i < s.size(); ++i) {
		ans = ans * k + calc(s[i]);
	}
	return ans;
}

int main() {

	int trm = change(8, "12");  //10
	//int trm = change(2, "111");  //7
	//int trm = change(16, "2F");  //47
	cout << trm << endl;
	return 0;
}
*/


/*
#include<iostream>
using namespace std;
string res = "";

string slove(int x, int k) {
	res = "";
	while (x >= 1) {
		int tmp = x % k;
		if (tmp <= 9) {
			res = res + (char)('0' + tmp);
		}
		else {
			res = res + (char)('A' + tmp- 10);
		}
		x /= k;
	}
	reverse(res.begin(), res.end());
	return res;
}


int main() {
	
	int n = 16;
	cout << slove(n,2) << endl;
	return 0;
}
*/

/*
#include <iostream>
using namespace std;
int ans = 0;
int qwe = 0;

int solve(int s, int k) {
	qwe = 0;
	while (s != 0) {
		int tmp = s % k;
		qwe += tmp;
		s /= k;	
	}
	return qwe;
}

bool check(int x) {
	if (solve(x, 2) == solve(x, 4)) 
		return true;
	return false;
}

int main()
{
	for (int i = 1; i <= 2024; ++i) {
		if (check(i)) {
			//cout << i << endl;
			ans++;
		}
			
	}
	cout << ans;
	return 0;
}
*/


/*
#include <iostream>
using namespace std;
int t, n, m;

int solve(int n, int m) {
	
	if (n == m ) {
		return 1;
	}
	if (m == 0) {
		return 1;
	}
	return solve(n-1,m-1)+solve(n-1,m);
}

int main()
{
	cin >> t;
	while (t--) {
		cin >> n >> m;
		cout << solve(n, m) << endl;
	}


	return 0;
}

*/

/*
#include <iostream>
using namespace std;

int solve(int x) {
	if (x == 0)
		return 1;
	if (x % 2 == 0 && x != 0)
		return solve(x / 2);
	if (x % 2 != 0)
		return solve(x-1) + 1;
}

int main()
{
	int x;
	cin >> x;
	int res= solve(x);
	cout << res << endl;
	return 0;
}
*/


/*
#include <iostream>
using namespace std;
int n;
int solve(int x) {
	int res = 0;
	while (x != 0) {
		if ((x & 1) == 1)
			res++;
		x = x >> 1;
	}
	return res;
}

int main()
{
	cin >> n;
	int ret = solve(n);
	cout << ret << endl;
	return 0;
}
*/

/*
#include <iostream>
using namespace std;
int n;
int solve(int x) {
	int res = 0;
	while (x != 0) {
		int temp = x % 2;
		res += temp;
		x /= 2;
	}
	return res;
}

int main()
{
	cin >> n;
	int ret = solve(n);
	cout << ret << endl;
	return 0;
}
*/


#include <iostream>
using namespace std;
const int N = 1e6 + 10;
int t;
int n, k;
int a[N];

bool check(int x, int k) {

	while (x != 0) {
		if ((k & 1) == 0) {
			if ((x & 1) == 1) {
				return false;
			}
		}
		k = k >> 1;
		x = x >> 1;
	}
	return true;
}


int main()
{
	
	cin >> t;
	while (t--) {
		int test = 0; //循环输入多组数据，一定要在每次数据输入前初始化，血与泪的教训！！！！！！ 不然test每次都延续上次的
		cin >> n >> k;
		for (int i = 0; i < n; ++i) {
			cin >> a[i];
			if (check(a[i], k)) {
				test |= a[i];
			}
		}
		if (test == k)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
		
	}
	
	return 0;
}


